Skip to content

Set edit links dynamically for RtD preview and PR builds#3280

Merged
mnocon merged 2 commits into
5.0from
lychee-links-on-new-files
Jul 15, 2026
Merged

Set edit links dynamically for RtD preview and PR builds#3280
mnocon merged 2 commits into
5.0from
lychee-links-on-new-files

Conversation

@mnocon

@mnocon mnocon commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Target: 5.0, 6.0

The current link checker has a bug: for new Markdown files, it reports 404 for "View on GitHub" button:

#3279 (comment)

Errors in site/release_notes/cohesivo_v6.0_deprecations/index.html

    [404] https://github.com/ibexa/documentation-developer/blob/5.0/docs/release_notes/cohesivo_v6.0_deprecations.md (at 194:10) | Rejected status code: 404 Not Found

This is because the 5.0 branch is hardcoded as "edit_uri", and it looks into the 5.0 branch for changes that were not merged yet.

This PR sets the value dynamically, so for it will work correctly for PRs and for ReadTheDocs preview builds.

Doc:

The [slug](https://docs.readthedocs.com/platform/stable/glossary.html#term-slug) of the version being built, such as latest, stable, or a branch name like feature-1234. For [pull request builds](https://docs.readthedocs.com/platform/stable/pull-requests.html), the value will be the pull request number.

(from https://docs.readthedocs.com/platform/stable/reference/environment-variables.html )

So for RTD previews, commit hash is used.

Tested locally by setting the variable before building and checking the output in the site dir:

export READTHEDOCS_VERSION_TYPE=external
export READTHEDOCS_GIT_COMMIT_HASH=123456    
~/python/bin/python3.13 -m mkdocs build --strict
cat site/index.html | grep 123456

<a href="https://github.com/ibexa/documentation-developer/blob/123456/docs/index.md" title="source.link.title" class="source-github">

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Preview of modified files: no change to preview.

@mnocon mnocon force-pushed the lychee-links-on-new-files branch from bfccad4 to 0496399 Compare July 7, 2026 11:04
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Summary

Status Count
🔍 Total 760081
🔗 Unique 15030
✅ Successful 7270
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 752808
❓ Unknown 0
🚫 Errors 3
⛔ Unsupported 0

Errors per input

Errors in site/ibexa_cloud/ibexa_cloud_cli/index.html

Errors in site/search/search_api/index.html

Errors in site/templating/queries_and_controllers/content_queries/index.html

Full Github Actions output

@mnocon mnocon force-pushed the lychee-links-on-new-files branch from 0496399 to b14948b Compare July 7, 2026 12:56
@mnocon mnocon marked this pull request as ready for review July 7, 2026 13:03
@mnocon mnocon requested a review from a team July 7, 2026 13:04
@ibexa-workflow-automation-1 ibexa-workflow-automation-1 Bot requested review from adriendupuis, dabrt and julitafalcondusza and removed request for a team July 7, 2026 13:05
@mnocon mnocon merged commit e546b04 into 5.0 Jul 15, 2026
10 of 11 checks passed
@mnocon mnocon deleted the lychee-links-on-new-files branch July 15, 2026 10:50
mnocon added a commit that referenced this pull request Jul 15, 2026
* Set edit links dynamically for RtD preview and PR builds

* Replaced edit with blob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants